<template>
    <div class="sub">
        <h3><i class="el-icon-edit"></i>写下你的回答</h3>

        <el-input  type="textarea" :autosize="{ minRows: 8, maxRows: 14}" v-model="content"></el-input>

        <el-button class="submit" type="primary" @click="submit">发布</el-button>

    </div>
</template>

<script>
import {postRequest,getRequest} from '../utils/api.js'
export default {
    name: 'Writereply',

    data() {
        return {
            content:'', 
        };
    },

    mounted() {
        
    },
    props:['problemId','echoReply'],
    methods: {
        submit(){
            if(this.content == ''){
                this.$message.error({
                   message:'回答不能为空'
                })
                return;
            }
            postRequest('/qa/reply/insertReply',{
                problemId:this.problemId,
                content:this.content
            }).then((result) => {
                if(result)
                    this.echoReply(result);
                console.log('返回的data',result);
            }).catch((err) => {
                
            });
        }
    },
};
</script>

<style  scoped>
h3{
    text-align: center;
}
.sub{
    text-align: center;
}
.submit{
    margin-top: 9px;
}
</style>